
#import "OosDaoDelegatedTicket.h"
#import "../../GData/Common/BaseClasses/GDataServiceBase.h"


@implementation OosDaoTicket

@synthesize identifier = mIdentifier;
@synthesize sentObject = mSentObject;
@synthesize gdataTicket = mGdataTicket;

- (void)dealloc
{
    [mSentObject release];
    [super dealloc];
}

+ (OosDaoTicket *) ticket
{
	return [[[OosDaoTicket alloc] init] autorelease];
}

- (BOOL) cancel
{
	return FALSE;
}

- (NSUInteger) progress
{
	return DaoProgressNotKnown;
}

@end

@implementation OosDaoDelegatedTicket

+ (OosDaoTicket *) ticketWithDelegate: (id<OosDaoTicketDelegate>) delegate
{
	OosDaoDelegatedTicket *ticket = [[[OosDaoTicket alloc] init] autorelease];
	ticket->mDelegate = delegate;
	return ticket;
}

- (BOOL) cancel
{
	if (mDelegate && [mDelegate respondsToSelector:@selector(cancel:)]) {
		return [mDelegate cancel];
	}
	return FALSE;
}

- (NSUInteger) progress
{
	if (mDelegate && [mDelegate respondsToSelector:@selector(cancel:)]) {
		return [mDelegate progress];
	}
	return DaoProgressNotKnown;
}

@end

